------------------------------------------------------
--
-- classe principale del gioco lato client
--
--
--
------------------------------------------------------
with Timer_Package;		use Timer_Package;
with Field_package;		use Field_package;
with Ball_Package;		use Ball_Package;
with Player_Package;	use Player_Package;
with Manager_Package;	use Manager_Package;
with Referee_Package;	use Referee_Package;
with Display_Package;	use Display_Package;
with Gtk.Main;			use Gtk.Main;
-- with Server_Package;	use Server_Package;
	
package body Client_Package is
		
	task body Client is
	
			-- il client deve solo inizializzare l'interfaccia grafica 
			-- andando a prendere i dati direttamente dal server

			F : Field_Access;
			B : Ball_Access;
			Tm : TimeCount_Access;
			Tmr : Timer_Access;

			-- inizializzazione dell'array di giocatori
			Players : array (1..11) of Player_Access;
	
			-- inizializzazione delle squadre
			T1 : Team_Access := new Team;

			-- manager
			M1 : Manager_Access := new Manager(F, T1);
	
		begin

			Init(F, B, Tm, Tmr);

			-- inizializzazione dei giocatori
			Players( 1) := new Player ( 1, 	GKP, 	T1, 	1,		F, B, 60, 60, 60, 70);
			Players( 2) := new Player ( 2, 	LDF, 	T1, 	1,		F, B, 60, 50, 50, 70);
			Players( 3) := new Player ( 3, 	CDF, 	T1, 	1,		F, B, 60, 60, 60, 70);
			Players( 4) := new Player ( 4, 	CDF, 	T1, 	1,		F, B, 60, 70, 70, 70);
			Players( 5) := new Player ( 5, 	RDF, 	T1, 	1,		F, B, 60, 60, 60, 70);
			Players( 6) := new Player ( 6, 	LMF, 	T1, 	1,		F, B, 60, 70, 70, 70);
			Players( 7) := new Player ( 7, 	CMF, 	T1, 	1,		F, B, 60, 40, 90, 70);
			Players( 8) := new Player ( 8, 	CMF, 	T1, 	1,		F, B, 60, 60, 70, 70);
			Players( 9) := new Player ( 9, 	RMF, 	T1, 	1,		F, B, 60, 50, 60, 70);
			Players(10) := new Player (10, 	LFW, 	T1, 	1,		F, B, 60, 40, 80, 70);
			Players(11) := new Player (11, 	RFW, 	T1, 	1,		F, B, 60, 70, 60, 70);

			-- inizializza le squadre in campo
			for i in 1..11 loop
				T1(i) := Players(i);
			end loop;
	
			-- lancio dell'interfaccia grafica
			Gtk.Main.Set_Locale;
			Gtk.Main.Init;
			Display_Package.References(F, B, Tm, Tmr);
			Display_Package.Init;
			Gtk.Main.Main;

	end Client;
	
end Client_Package;